<?php

// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// $Id: RBAC.class.php 2601 2012-01-15 04:59:14Z liu21st $

class SAC {

    // 认证方法
    static public function authenticate($map, $model='') {
        if (empty($model))
            $model = C('USER_AUTH_MODEL');
        //使用给定的Map进行认证
        return M($model)->where($map)->find();
    }

    // 登录检查
    static public function checkLogin() {
            //检查认证识别号
            if (!$_SESSION[C('USER_AUTH_KEY')]) {
                return false;
            }
        return true;
    }

}